package com.alvin.commonlibrary

import android.app.Activity
import android.content.Intent
import android.os.Bundle
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : Activity() {


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        scan.setOnClickListener { startActivity(Intent(this, ZxingScanactivity::class.java)) }

        scanoa.setOnClickListener { startActivity(Intent(this, ZxingScanactivityOa::class.java)) }

        scanbarcode.setOnClickListener { startActivity(Intent(this, ZxingScanactivityBarCode::class.java)) }
    }


    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        if (requestCode == 0 && resultCode == Activity.RESULT_OK && data != null) {
            val result = data.getStringExtra("result")
            tv_result!!.text = result
        }
    }
}
